<?php
class SDK
{
    //
    // 返回开发者列表，开发者列表里包含了各自接入的apps
    //
    public static function developers_with_apps ()
    {
        $developers = SDK_developers::lists('valid');
        $apps       = SDK_packages::lists('valid');

        foreach ($developers as & $dev)
        {
            $did = Arr::get($dev, 'uid', 0);
            $dev['apps'] = array();

            foreach ($apps as $app) 
            {
                if ($app['developer'] == $did)
                    $dev['apps'][] = $app;
            }
        }

        return $developers;
    }

    //
    // 导入SDK每日下载数据
    // 
    public static function import ($day, $pkgname, $advertise_list)
    {
        return SDK_Daily::import($day, $pkgname, $advertise_list);
    }
}
